package com.study.ApplicationEvent2.config;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import com.study.ApplicationEvent2.UserBean;
import com.study.ApplicationEvent2.UserRegisterEvent;

@Component
public class AnnotationRegisterListener {

	@EventListener
	/**
     * 注册监听实现方法
     * @param userRegisterEvent 用户注册事件
     */
	public void register(UserRegisterEvent userRegisterEvent){
		UserBean user = userRegisterEvent.getUser();
		
		//省略业务逻辑
		
		//输出注册用户信息
		System.out.format("@EventListener注册信息，用户名:%s,密码: %s",user.getName(),user.getPassword());
	}
}
